import { configureStore } from "@reduxjs/toolkit";
import cart from "./modules/cart";
import { persistStore, persistReducer } from "redux-persist";
import storage from "redux-persist/lib/storage";
const persistConfigCarts = {
  key: "carts",
  storage,
};
const persistedReducerCarts = persistReducer(persistConfigCarts, cart);

export const store = configureStore({
  reducer: {
    carts: persistedReducerCarts,
  },
  middleware: (getDefaultMiddleware) =>
    getDefaultMiddleware({
      serializableCheck: false,
    }),
});
export const persistor = persistStore(store);
